//
//  TTLiveBriefResidentView.swift
//  TTProduct
//
//  Created by Toj on 3/25/21.
//  Copyright © 2021 TTProduct. All rights reserved.
//

import Cocoa

class TTLiveBriefResidentView: NSView {
    
    // 昵称
    lazy var nicknameLabel: TTLabel = {
        let view = TTLabel()
        view.lineBreakMode = .byTruncatingTail
        view.textColor = NSColor.init(hexColor: "#6B7279")
        view.font = NSFont.systemFont(ofSize: 11)
        return view
    }()
    
    // 放大窗口
    lazy var zoomButton: TTButton = {
        let view = TTButton()
        return view
    }()
    
    override init(frame frameRect: NSRect) {
        super.init(frame: frameRect)
        
        setupMakeAddSubviews()
        setupMakeUI()
    }
    
    required init?(coder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func layout() {
        super.layout()
        setupMakeLayoutSubviews()
    }
}

extension TTLiveBriefResidentView {
    
    private func setupMakeAddSubviews() {
        addSubview(zoomButton)
        addSubview(nicknameLabel)
    }
    
    private func setupMakeLayoutSubviews() {
        
        zoomButton.snp.makeConstraints { (make) in
            make.right.equalTo(snp.right).offset(-4)
            make.centerY.equalTo(self)
            make.width.equalTo(17)
            make.height.equalTo(17)
        }
        
        nicknameLabel.snp.makeConstraints { (make) in
            make.left.equalTo(6)
            make.centerY.equalTo(self)
            make.right.equalTo(zoomButton.snp.left).offset(-6)
        }
    }
    
    private func setupMakeUI() {
        tt_backgroundColor = NSColor.white
    }
}
